﻿namespace Beetle
{
    using System;
    using System.Runtime.CompilerServices;

    public abstract class Counter : ICounter
    {
        private int _field_a;
        [CompilerGenerated]
        private Action<ICounter> _field_b;

        protected Counter()
        {
        }

        public abstract void Load(BufferReader reader);
        public void Reduce()
        {
            lock (this)
            {
                this._field_a--;
                if ((this._field_a == 0) && (this.Disposed != null))
                {
                    this.Disposed(this);
                }
            }
        }

        public abstract void Save(BufferWriter writer);
        public void SetCount(int count)
        {
            this._field_a = count;
        }

        public Action<ICounter> Disposed
        {
            [CompilerGenerated]
            get
            {
                return this._field_b;
            }
            [CompilerGenerated]
            set
            {
                this._field_b = value;
            }
        }
    }
}

